import SwiftUI

struct RootView: View {
    @EnvironmentObject private var appEnvironment: AppEnvironment
    @StateObject private var router = AppRouter()
    var body: some View {
        TabView(selection: $router.selectedTab) {
            NavigationStack {
                HomeView(service: appEnvironment.destinationService)
            }
            .tabItem { Label("探索", systemImage: "globe.asia.australia") }
            .tag(AppTab.explore)

            NavigationStack {
                ItineraryView()
            }
            .tabItem { Label("行程", systemImage: "calendar") }
            .tag(AppTab.itinerary)

            ProfileView()
                .tabItem { Label("我的", systemImage: "person.circle") }
                .tag(AppTab.profile)
        }
        .environmentObject(router)
    }
}

#Preview {
    RootView()
        .environmentObject(AppEnvironment())
}


